from typing import Optional, Union
from pydantic import BaseModel


class ZBusModel(BaseModel):
    type: Optional[str] = None  # 接口类型 1：
    body: Optional[Union[dict, list]] = None  # 数据体

    def to_dict(self):
        return f"{{type:{self.type},body:{self.body}}}"
